//
//  TeacherFeedBackViewController.m
//  LoveDraw
//
//  Created by 零零壹 on 2017/7/13.
//  Copyright © 2017年 梁晨. All rights reserved.
//

#import "TeacherFeedBackViewController.h"
#import "PlaceholderTextView.h"

@interface TeacherFeedBackViewController ()
@property(nonatomic,strong)PlaceholderTextView *TextV;
@property(nonatomic,strong)UIButton *commitBtn;

@end

@implementation TeacherFeedBackViewController
-(PlaceholderTextView *)TextV
{
    if (!_TextV) {
        _TextV = [[PlaceholderTextView alloc]initWithFrame:CGRectMake(15, 15, KscreenW-30, 250)];
        _TextV.placeholder = @"请输入要投诉或留言的内容";
    }
    return _TextV;
}

-(UIButton *)commitBtn
{
    if (!_commitBtn){
        _commitBtn = [UIButton buttonWithType:(UIButtonTypeSystem)];
        [_commitBtn setTitle:@"提交留言" forState:(UIControlStateNormal)];
        [_commitBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
        _commitBtn.backgroundColor =PKCOLOR(255, 108, 0);
        _commitBtn.frame = CGRectMake(15, 350, KscreenW-30, 45);
        _commitBtn.layer.cornerRadius = 5;
        _commitBtn.layer.masksToBounds = YES;
        [_commitBtn addTarget:self action:@selector(Commit) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _commitBtn;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColors(0xF8F9FA);
    [self.view addSubview:self.TextV];
    [self.view addSubview:self.commitBtn];
}

-(void)Commit
{
    if (self.TextV.text.length == 0) {
        [HUD showText:@"请将内容填写完整" AfterTime:1];
        return;
    }
    [RequestManager HudRequestWithUrl:@"/index.php?g=App&m=Index&a=feedback" parmDic:@{@"remark":self.TextV.text} requestType:RequestPOST view:self.view Success:^(id data)
     {
         [HUD showText:@"提交成功" AfterTime:1];
         [self.navigationController popViewControllerAnimated:YES];
     } error:^(NSError *error) {

     }];
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    self.navigationItem.title = @"投诉留言";
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
